package dto

import (

	"go-admin/app/xinghe/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type HostInformationGetPageReq struct {
	dto.Pagination     `search:"-"`
    IpAddress string `form:"ipAddress"  search:"type:contains;column:ip_address;table:host_information" comment:"IP地址"`
    Hostname string `form:"hostname"  search:"type:contains;column:hostname;table:host_information" comment:"主机名"`
    HostInformationOrder
}

type HostInformationOrder struct {
    Id string `form:"idOrder"  search:"type:order;column:id;table:host_information"`
    CreateBy string `form:"createByOrder"  search:"type:order;column:create_by;table:host_information"`
    UpdateBy string `form:"updateByOrder"  search:"type:order;column:update_by;table:host_information"`
    CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:host_information"`
    UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:host_information"`
    DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:host_information"`
    IpAddress string `form:"ipAddressOrder"  search:"type:order;column:ip_address;table:host_information"`
    Port string `form:"portOrder"  search:"type:order;column:port;table:host_information"`
    Hostname string `form:"hostnameOrder"  search:"type:order;column:hostname;table:host_information"`
    OperatingSystem string `form:"operatingSystemOrder"  search:"type:order;column:operating_system;table:host_information"`
    Location string `form:"locationOrder"  search:"type:order;column:location;table:host_information"`
    Status string `form:"statusOrder"  search:"type:order;column:status;table:host_information"`
    Description string `form:"descriptionOrder"  search:"type:order;column:description;table:host_information"`
    
}

func (m *HostInformationGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type HostInformationInsertReq struct {
    Id int `json:"-" comment:""` // 
    IpAddress string `json:"ipAddress" comment:"IP地址"`
    Port string `json:"port" comment:"端口"`
    Hostname string `json:"hostname" comment:"主机名"`
    OperatingSystem string `json:"operatingSystem" comment:"操作系统"`
    Location string `json:"location" comment:"本地名"`
    Status string `json:"status" comment:"状态"`
    Description string `json:"description" comment:"描述"`
    common.ControlBy
}

func (s *HostInformationInsertReq) Generate(model *models.HostInformation)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
    model.IpAddress = s.IpAddress
    model.Port = s.Port
    model.Hostname = s.Hostname
    model.OperatingSystem = s.OperatingSystem
    model.Location = s.Location
    model.Status = s.Status
    model.Description = s.Description
}

func (s *HostInformationInsertReq) GetId() interface{} {
	return s.Id
}

type HostInformationUpdateReq struct {
    Id int `uri:"id" comment:""` // 
    IpAddress string `json:"ipAddress" comment:"IP地址"`
    Port string `json:"port" comment:"端口"`
    Hostname string `json:"hostname" comment:"主机名"`
    OperatingSystem string `json:"operatingSystem" comment:"操作系统"`
    Location string `json:"location" comment:"本地名"`
    Status string `json:"status" comment:"状态"`
    Description string `json:"description" comment:"描述"`
    common.ControlBy
}

func (s *HostInformationUpdateReq) Generate(model *models.HostInformation)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
    model.IpAddress = s.IpAddress
    model.Port = s.Port
    model.Hostname = s.Hostname
    model.OperatingSystem = s.OperatingSystem
    model.Location = s.Location
    model.Status = s.Status
    model.Description = s.Description
}

func (s *HostInformationUpdateReq) GetId() interface{} {
	return s.Id
}

// HostInformationGetReq 功能获取请求参数
type HostInformationGetReq struct {
     Id int `uri:"id"`
}
func (s *HostInformationGetReq) GetId() interface{} {
	return s.Id
}

// HostInformationDeleteReq 功能删除请求参数
type HostInformationDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *HostInformationDeleteReq) GetId() interface{} {
	return s.Ids
}
